package com.lanou.service.Impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lanou.entity.FM;
import com.lanou.mapper.FmMapper;
import com.lanou.service.FMService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName FMServiceImpl
 * @Description TODO
 * @Author lizhenjiang
 * @Date 2025年08月13日 19:42
 * @Version 1.0
 */
@Service
public class FMServiceImpl implements FMService {
    @Autowired
    private FmMapper fmMapper;

    @Override
    public FM getFM(Integer id) {
        return fmMapper.selectFmById(id);
    }

    @Override
    public PageInfo<FM> getFMList(FM fm, Integer pageNum, Integer pageSize) {
        if(pageNum==null&&pageSize==null){
            PageInfo<FM> pageInfo= new PageInfo<>(fmMapper.selectFmList(fm));
            return pageInfo;
        }
        PageHelper.startPage(pageNum, pageSize);
        List<FM> fms=fmMapper.selectFmList(fm);
        PageInfo<FM> pageInfo=new PageInfo<>(fms);
        return pageInfo;
    }
}
